<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div class="outer" id="outer">
      <ul class="list list-1">
        <li name="li-item" class="item item2 item3">list-one</li>
        <li class="item">list-two</li>
        <li class="item">list-three</li>
      </ul>
    </div>
    <div class="outer2" id="outer"></div>
    <div id="foo\bar">ccc</div>

    <script>
      var nodeList = document.getElementsByClassName("item");
      console.log("len:", nodeList.length); // 3

      // 添加新的元素
      var liEl = document.createElement("li");
      liEl.className = "item";
      liEl.innerHTML = "list-for";
      document.querySelector(".list").appendChild(liEl);

      console.log("len:", nodeList.length); //4
    </script>
  </body>
</html>
